import java.util.Scanner;

public class Main {
    public static void main1(String[] args) {
        Employee employee = new Employee("张三",12,123456789,"西安市");
        System.out.println(employee.name+" "+employee.age+" "+employee.phone+" " +employee.address);
    }

    public static void main2(String[] args) {
        ElectroBicycle electroBicycle = new ElectroBicycle("车轮",56);
        electroBicycle.brake();
    }

    public static void main3(String[] args) {
        Undergraduate undergraduate = new Undergraduate("张三");
        Graduate graduate = new Graduate("李四");
        undergraduate.category();
        graduate.category();
    }

    public static void main5(String[] args) {


        City city1 = new City("李四",12,"男","宝鸡");
        city1.showInFor();
        City city2 = new City("西安");
        city2.showInFor();
    }

    public static void main6(String[] args) {
        Position position = new Position();
        position.setTitle("医生");
        position.setSalary(12000);
        position.setRequirment("无");
        position.setAddress("西安");
        System.out.println(position.getTitle()+" "+ position.getSalary()+" "+position.getRequirment()+" "+position.getAddress());
    }

    public static void main7(String[] args) {
        student1 s = new student1("张三","男",13,1,78,96,86);
        System.out.println(s);

    }

    public static void main8(String[] args) {
        try{
            int c = 12/0;
        }catch(ArrayIndexOutOfBoundsException e){
            e.printStackTrace();
        }
    }

    public static void main9(String[] args) {
        Scanner scan = new Scanner(System.in);
        boolean flag = true;
        while(flag){
            try{
                //nextInt是将输入的下一个记录扫描为int类型，如果下一个元素不能转换为有效的int值，就会报出现异常
                //如果第一次循环输入的值不是int类型的，并且在本次循环中没有将当前输入的字符跳过，到下一次循环，
                // 指针还是在开始位置，第一次循环输入的字符，还是会被这次循环的nextInt方法读到，这个时候由于不是字符类型，
                // 所以还是会报相同的异常。
                int mun = scan.nextInt();
                System.out.println(mun);
                flag = false;
            }catch(Exception e){
                System.out.println("异常类型"+e);
                flag = true;
                //使用next方法是因为没调用一次，指针就会向下移动，这里我们输入的字符不是数字，就需要使用next方法将我们输入的这个字符读掉，指针向下移动，就不会出现循环报相同异常的问题
                scan.next();
            }finally{
                System.gc();
                System.out.println("释放内存资源");
            }
        }
        scan.close();
    }

    public static void main10(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入商品名和商品件数，中间使用空格隔开");
        String product = scan.nextLine();
        Payment payment = new Payment();
        try{
            payment.pay(product);
        }catch(ArrayIndexOutOfBoundsException e){
            System.out.println("异常信息：数组下标越界异常");
        }finally{
            scan.close();
        }
    }

    public static void main11(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入成绩");
        double score = scan.nextDouble();
        PrintScore printScore = new PrintScore();
        try{
            printScore.printScore(score);
        }catch(Exception e){
            e.printStackTrace();
        }
        scan.close();
    }
    public static void printScore(double score){
        assert(score >= 0 && score <= 100):"异常信息：分数必须处于1~100";
        System.out.println("该学生成绩是："+score );
    }


    public static void main12(String[] args) {
        double score = 110;
        PrintScore printScore = new PrintScore();
        try{
            printScore.printScore(score);
        }catch(AssertionError e){
            System.out.println(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main13(String[] args) {
        try{
            int[] array = new int[3];
            for (int i = 0; i < 5; i++) {
                array[i] = i;
//                int c = array[i]/0;
            }

        }catch(ArrayIndexOutOfBoundsException e){
            e.printStackTrace();
        }catch(ArithmeticException e){
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {


        String age = "7";

        System.out.println(age+10);
    }
}
